/**
 */

package test;

import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.util.HashMap;
import java.util.Map;
import java.util.SortedMap;
import java.util.TreeMap;
import org.junit.Test;
import com.bei_en.common.util.amap.AmapStoreUtil;
import com.google.gson.Gson;

/**
 * @author Guocg
 *
 */
public class sdf {

	@Test
	public void sf() {

		// System.out.println("桂A23456".matches("^(?:桂A|A)[\\dA-Z]{5}$"));
		// System.out.println(Pattern.matches("^(?:桂A|A)[\\dA-Z]{5}$",
		// "桂A23456"));
	}

	// @Test
	public void sf1() throws UnsupportedEncodingException {

		System.out.println(URLEncoder.encode("结婚是传言？撒贝宁节目自曝单身：光棍很久了", "utf-8"));
	}

	// @Test
	public void aa1() throws UnsupportedEncodingException {

		SortedMap map = new TreeMap();
		map.put("name", "sdf2");
		System.out.println("tableid=" + AmapStoreUtil.createTable(map));

	}

	// @Test
	public void aa2() throws UnsupportedEncodingException {

		Gson gson = new Gson();
		SortedMap map = new TreeMap();
		/*
		 * 1：经纬度；格式示例：104.394729,31.125698 2：地址；标准格式示例：北京市朝阳区望京阜通东大街6号院3号楼
		 */
		map.put("loctype", 2);
		Map map1 = new HashMap();
		map1.put("_name", "测试1");
		// map1.put("_location", "104.394729,31.125698");//当loctype=1时，必填
		/*
		 * 1: gps 默认2: autonavi 3: baidu
		 */
		map1.put("coordtype", 2);
		map1.put("_address", "南宁市东葛葛村");// 当loctype=2时，必填
		map1.put("comment", "家");// 自定义列
		map.put("data", gson.toJson(map1));
		System.out.println("_id=" + AmapStoreUtil.createData(map));

	}

	// @Test
	public void aa3() throws UnsupportedEncodingException {

		Gson gson = new Gson();
		SortedMap map = new TreeMap();
		/*
		 * 1：经纬度；格式示例：104.394729,31.125698 2：地址；标准格式示例：北京市朝阳区望京阜通东大街6号院3号楼
		 */
		map.put("loctype", 2);
		Map map1 = new HashMap();
		map1.put("_id", "3");// 动态更新,为null则置空
		// map1.put("_name", "dfg");
		// map1.put("_location", "104.394729,31.125698");//当loctype=1时，必填
		/*
		 * 1: gps 默认2: autonavi 3: baidu
		 */
		// map1.put("coordtype", 2);
		// map1.put("_address", "南宁市东葛葛村");// 当loctype=2时，必填
		map1.put("comment", "我家");// 自定义列
		map.put("data", gson.toJson(map1));
		System.out.println("_id=" + AmapStoreUtil.updateData(map));

	}

	// @Test
	public void aa4() throws UnsupportedEncodingException {

		Gson gson = new Gson();
		SortedMap map = new TreeMap();
		map.put("ids", "2,4,5");
		System.out.println("_id=" + AmapStoreUtil.deleteData(map));

	}
}
